package cn.lili.modules.order.order.entity.vo;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dos.OrderItem;
import cn.lili.modules.order.order.entity.dos.Trade;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;
@Data
@NoArgsConstructor
public class TradeVO extends Trade {


    private static final long serialVersionUID = 5820637552656388777L;

    @ApiModelProperty(value = "订单商品项目")
    private List<OrderSimpleVO> orders;

    public TradeVO (Trade trade,List<OrderSimpleVO> orders){
        BeanUtil.copyProperties(trade, this);
        this.setOrders(orders);
    }

    /**
     * 初始化自身状态
     */
    public AllowOperation getAllowOperationVO() {
        //设置订单的可操作状态
        return new AllowOperation(this.getTradeStatus());
    }
}
